package com.tanglongan.designPattern.dp18_observer.demo01;

import java.util.Observable;

public class Csdn extends Observable {
    private String name = "CSDN生态圈";
    private static Csdn csdn = null;

    private Csdn() {
    }

    public static Csdn getInstance() {
        if (csdn == null) {
            csdn = new Csdn();
        }
        return csdn;
    }

    public String getName() {
        return name;
    }

    public void publishQuestion(Question question) {
        System.out.println(question.getUserName() + "在" + this.name + "上提交了一个问题。");
        setChanged();
        notifyObservers(question);
    }
}
